package com.example.mes.service.Imple;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mes.mapper.WorkerMapper;
import com.example.mes.model.PageResult;
import com.example.mes.model.WorkerInfo;
import com.example.mes.service.interfase.WokerInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WorkerImpl implements WokerInfo {
    @Autowired(required = false)
//    RedisTemplate redisTemplate;
        private WorkerMapper workerMapper;

    @Override
    public PageResult<WorkerInfo> findList() {
//        ValueOperations operations = redisTemplate.opsForValue();
        PageResult<WorkerInfo>result=new PageResult<WorkerInfo>();
        Page<WorkerInfo> page = workerMapper.selectPage(new Page<>(1,4),null);
//        result.setData((List<WorkerInfo>) operations.get("wokerInfo"));
        result.setData(page.getRecords());
        return result;
    }

    @Override
    public void deleteById(int id) {
//        redisTemplate.delete(id);
        workerMapper.deleteById(id);
    }
}
